﻿@model IEnumerable<LandManager.Web.Models.InfoModel>

@{
    ViewBag.Menu = "数据统计";

}

@*<h2>Welcome</h2>*@
<script type="text/javascript" src="~/Scripts/echarts.common.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#chart").empty();
        //var v = "land_type";

        //var json = {
        //    Key: v
        //};

        $.ajax({
            url: app + "/Home/QueryStatistic",
            type: "Post",
            //data: json,
            success: function (data) {
                if (data != null) {
                    DrawBar(JSON.parse(data), "chart");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus + "     " + errorThrown);
            }
        });
    });

    function DrawBar(pieData, id) {

        var xValue = new Array();
        var yValue = new Array();

        for (var i = 0; i < pieData.length; i++) {
            xValue[i] = pieData[i].name;
            yValue[i] = pieData[i].value;
        }

        var dom = document.getElementById(id);
        var myChart = echarts.init(dom);
        option = null;
        option = {
            tooltip: {},
            legend: {
                data: ['面积']
            },
            xAxis: {
                data: xValue
            },
            yAxis: {},
            series: [{
                //name: '销量',
                type: 'bar',
                data: yValue,
                itemStyle: {
                    normal: {
                        shadowBlur: 200,
                        label: {
                            show: true,
                            formatter: '{b} : {c}',
                            textStyle: {
                                color: '#2573c7'
                            }
                        },
                        labelLine: { show: true },
                    },
                }
            }]
        };;

        if (option && typeof option === "object") {
            myChart.setOption(option, true);
        }
    }
</script>
<style type="text/css">
    .divSty {
        padding: 25px 15px 5px 15px;
        font-family: 'Microsoft YaHei';
    }

    .tbSty {
        width: 40%;
        table-layout: fixed;
        border: solid #9D9D9D;
        border-width: 1px 0px 0px 1px;
    }

    .tdSty {
        word-wrap: break-word;
        text-align: center;
        vertical-align: middle;
        border: solid #9D9D9D;
        border-width: 0px 1px 1px 0px;
        font-size: 0.8em;
    }

    .tdheaderSty {
        text-align: center;
        vertical-align: middle;
        border: solid #9D9D9D;
        border-width: 0px 1px 1px 0px;
        font-size: 0.9em;
        height: 35px;
    }

    .headerSty {
        word-wrap: break-word;
        text-align: center;
        vertical-align: middle;
        background-color: #2573c7;
        color: #FFFFFF;
    }

    .selectSty {
        height: 26px;
        width: 210px;
    }

    .textStyle {
        height: 20px;
        width: 190px;
    }

    .texttdSty {
        padding-right: 15px;
    }

    .btnSty {
        width: 120px;
        height: 20px;
        vertical-align: central;
        /*margin: auto 10px auto 10px;*/
        text-align: center;
        vertical-align: central;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 2px;
        background: #DADADA;
        color: #000;
        cursor: auto;
        display: inline-block;
        text-decoration: none;
    }
</style>

<div>
    <div>
        <table id="handleland" class="tbSty" style="width: 80%; margin-top: 10px; margin-left: auto; margin-right: auto; " cellspacing="0">
            <tr class="headerSty">
                <td colspan="5" class="tdheaderSty">信息统计列表</td>
            </tr>
            <tr class="headerSty">
                <td class="tdheaderSty" style="width: 5%">数量</td>
                <td class="tdheaderSty" style="width: 10%">类别</td>
                <td class="tdheaderSty" style="width: 5%">土地面积</td>
                <td class="tdheaderSty" style="width: 5%">账面原值</td>
                @*<td class="tdheaderSty" style="width: 5%">出租数量</td>
                    <td class="tdheaderSty" style="width: 5%">抵押数量</td>
                    <td class="tdheaderSty" style="width: 5%">土地开发利用数量</td>*@
                <td class="tdheaderSty" style="width: 5%">单位数量</td>
            </tr>
            @{
                if (Model != null && Model.Count() > 0)
                {
                    foreach (var item in Model)
                    {
            <tr>
                <td class="tdSty">@item.LandCount</td>
                <td class="tdSty">@item.LandType</td>
                <td class="tdSty">@item.LandArea</td>
                <td class="tdSty">@item.LandPrice</td>

                @*<td class="tdSty">0</td>
                    <td class="tdSty">0</td>
                    <td class="tdSty">0</td>*@
                <td class="tdSty">@item.AgencyCount</td>
            </tr>
                    }
                }
            }
        </table>
        <div id="chart" style="border: 1px solid #ccc; width: 80%; height: 300px; overflow: auto; margin-top: 10px; margin-left: auto; margin-right: auto"></div>
        <div style="clear:both"></div>
    </div>
</div>